package org.zht.dormpro.auth.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.zht.dormpro.auth.model.SysPermission;

import java.util.List;

public interface SysPermissionMapper {
    @Delete({"delete from sys_permission where id = #{id,jdbcType=INTEGER}"})
    int deleteByPrimaryKey(Integer id);

    int insertSelective(SysPermission record);

    @Select({"select",
            "id, name, type, url, perms_code, icon, parent_id, parent_ids, sort, available, ",
            "create_time, modify_time, creator, mender, permission_append",
            "from sys_permission",
            "where id = #{id,jdbcType=INTEGER}"})
    @ResultMap("org.zht.dormpro.auth.mapper.SysPermissionMapper.BaseResultMap")
    SysPermission selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SysPermission record);

    List<SysPermission> getAllMenuTree(@Param("menuIds") String menuIds);

    List<SysPermission> getUserPermissionByUid(Integer userid);

    int deleteSonMenu(Integer menuId);

    List<SysPermission> getUserMenuTree(Integer userId);

    List<SysPermission> getHasChildMenu();
}